﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" Title="Lịch họp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>	
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>

	<script src="../../Scripts/codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script>
	<link rel='STYLESHEET' type="text/css" href="../../Scripts/codebase/dhtmlxscheduler.css"/>
	
	<script src="../../Scripts/codebase/exts/dhtmlxscheduler_minical.js" type="text/javascript" charset="utf-8"></script>
	<link rel="stylesheet" href="../../Scripts/codebase/exts/dhtmlxscheduler_ext.css" type="text/css" media="screen" title="no title" charset="utf-8"/>
	
	
	<link rel="stylesheet" href="../../Scripts/extra/dhtmlxlayout.css" type="text/css" media="screen" title="no title" charset="utf-8"/>
	<link rel="stylesheet" href="../../Scripts/extra/skins/dhtmlxlayout_dhx_skyblue.css" type="text/css" media="screen" title="no title" charset="utf-8"/>

	<script src="../../Scripts/codebase/exts/dhtmlxscheduler_recurring.js" type="text/javascript" charset="utf-8"></script>
	<link rel='STYLESHEET' type="text/css" href="../../Scripts/codebase/exts/dhtmlxscheduler_recurring.css" media="screen" title="no title" charset="utf-8"/>

    <script src="../../Scripts/codebase/exts/dhtmlxscheduler_year_view.js" type="text/javascript" charset="utf-8"></script>

    <link rel="STYLESHEET" type="text/css" href="../../Scripts/codebase/dhtmlxcombo.css"/>
    <script  src="../../Scripts/codebase/dhtmlxcommon.js" type="text/javascript"></script>
    <script  src="../../Scripts/codebase/dhtmlxcombo.js" type="text/javascript"></script>
    <script src="../../Scripts/codebase/dhtmlxscheduler_units.js" type="text/javascript"></script>
<style type="text/css" media="screen">
	html, body{
		margin:0px;
		padding:0px;
		height:100%;
		overflow: hidden;
	}
	
	.dhx_calendar_click {
		background-color: #C2D5FC !important;
	}
</style>

<script type="text/javascript" charset="utf-8">
    var prev = null;
    var curr = null;
    var next = null;

    function doOnLoad() {
        var a = <%= Convert.ToBoolean(Session["TRUONG_KHOA"]) ? "true" : "false" %>;
        pnlLichHop.style.display = (a) ? "block" : "none";
        scheduler_here.style.width=(a) ? "980px" : "100%";

        ////
         var b = <%= Convert.ToInt32(Session["GIAO_VIEN"]) %>;
         if(b==0)
         {
         tenlogin.style.display="none";
         }

        /////
        var date_object = "";
        var loader = dhtmlxAjax.postSync("/Calendar/LoadData", " ");
        var data = eval('(' + loader.xmlDoc.responseText + ')');

        var sections = [];

        if (data.length != 0) {

               for (var i = 0; i < data.length; i++)
                {
                    var o = new Object;

                     o.key = data[i].MSNV;
                     o.label = data[i].Hoten;
                      sections[i] = o;
                      
                }

        }
        else {
            sections = [
			            { key: 111111, label: "Not Found Any Employee"}];


        }
        scheduler.locale.labels.unit_tab = "Giảng Viên";
        scheduler.createUnitsView("unit", "section_id", sections);
        scheduler.config.multi_day = true;
        scheduler.config.xml_date = "%Y-%m-%d %H:%i";

        scheduler.init('scheduler_here', new Date(), "unit");
        scheduler.load("/Calendar/Data");

      // scheduler.config.details_on_dblclick = true;
	//	scheduler.config.dblclick_create = true;
        // load comb chiase

        var dp = new dataProcessor("/Calendar/Save");
        dp.init(scheduler);
        dp.setTransactionMode("POST", false);
        
         var b = <%= Convert.ToInt32(Session["Disable"])%>;

         if(b==0)
         {
            	scheduler.attachEvent("onBeforeDrag",sections);
		        scheduler.attachEvent("onClick",sections);
                scheduler.attachEvent("onDblClick",sections);
                scheduler.attachEvent("onBeforeDrag",function(){return false;});
		        scheduler.attachEvent("onClick",function(){return false;});
		        scheduler.config.details_on_dblclick = false;
		        scheduler.config.dblclick_create = false;
         }

        var calendar = scheduler.renderCalendar({
            container: "cal_here",
            navigation: true,
            handler: function (date) {
                scheduler.setCurrentView(date, scheduler._mode);
            }
        });
        scheduler.linkCalendar(calendar);
        
    }
    
</script>
</head>


<body onload="doOnLoad();" style="background-color:#eff8fd">
	<%--<div id="cal_here" style='width:200px; float: left;'></div>--%>
  <%-- <div style='width:300px; float: left; height:300px'>--%>
    <div id="pnlLichHop" style='width:300px; float: left; font-family: Arial; font-size: 10pt;'>
    <% using (Html.BeginForm())
       { 
    %>
    
        <input type="hidden" id="Nguoi_tham_gia" name="Nguoi_tham_gia" />
        <table border="0">
            <tbody>
                <tr>
                    <td colspan="2">
                        <h4 style="border-bottom:1px solid #000;">Tạo lịch họp</h4>
                    </td>
                </tr>
                <tr>
                    <td valign="top">Ngày Bắt Đầu:</td>
                    <td><%: Html.TextBox("Ngay_bat_dau")%><br />dd/MM/yyyy hh:mm:ss</td>
                </tr>
                <tr>
                    <td valign="top">Ngày Kết Thúc:</td>
                    <td><%: Html.TextBox("Ngay_ket_thuc")%><br />dd/MM/yyyy hh:mm:ss</td>
                </tr>
                <tr>
                    <td>Chia sẻ:</td>
                    <td><%: Html.CheckBox("Chia_se")%></td>
                </tr>
                <tr>
                    <td valign="top">Nội dung:</td>
                    <td><%: Html.TextArea("Noi_dung") %></td>
                </tr>
                <tr>
                    <td colspan="2">Thành phần tham dự:</td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table border="0">
                            <%--<thead>
                                <tr>
                                    <th></th>
                                    <th>Họ Tên</th>
                                </tr>
                            </thead>--%>
                            <tbody>
                            <%
                                List<QL_LICHLAMVIEC.Models.GiangVien> dsGV = ViewData["DSGV"] as List<QL_LICHLAMVIEC.Models.GiangVien>;
                                if (dsGV != null)
                                {
                                   
                                    foreach (var gv in dsGV)
                                    {
                            %>
                                        <tr>
                                            <td><input type="checkbox" value="<%: gv.MSNV %>" onclick="toggleCheck(this);" /></td>
                                            <td><%: gv.HoTen + " - " + gv.Chucvu %></td>
                                        </tr>
                            <%
                                    }
                                }
                            %>
                            </tbody>
                        </table>
                    </td>

                </tr>
                <tr>
                    <td colspan="2">
                        <input type="submit" value="Save" />
                    </td>
                </tr>
            </tbody>
        </table>
    <%
       }
    %>
   
    <script type="text/javascript">
        function toggleCheck(chkbox) {
            var hid = document.getElementById('Nguoi_tham_gia');
            hid.value = (chkbox.checked) ? hid.value + chkbox.value + ";" : hid.value.replace(chkbox.value + ";", "");
        }
    </script>
    </div>
   <%--</div>--%>
   <% using (Html.BeginForm())
      { 
    %>
    <div ><table border="0" align="center" cellpadding="0" cellspacing="0" style="background-color:#eff8fd"><tr><td align="center"><a href="/Calendar/"><img src="../../Content/Images/LOGO.png" alt="" /></a></td><td><div id="tenlogin"><%:ViewData["TenLogin"] %>, <%:Html.ActionLink("Logout","../Calendar/Login") %></div></td></tr></table></div>
	    
        <%} %>
        <div id="scheduler_here" class="dhx_cal_container" style='width:980px; max-width:100%; height:100%;'> 
		<div class="dhx_cal_navline">
			<div class="dhx_cal_prev_button">&nbsp;</div>
			<div class="dhx_cal_next_button">&nbsp;</div>
			<div class="dhx_cal_today_button"></div>
			<div class="dhx_cal_date"></div>
			<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
			<div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
            <div class="dhx_cal_tab" name="unit_tab" style="right: 280px;"></div>
			<%--<div class="dhx_cal_tab" name="year_tab" style="right:280px;"></div>--%>
			<div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>
		</div>
		<div class="dhx_cal_header">
		</div>
		<div class="dhx_cal_data">
		</div>		
	</div>


    



</body>
</html>